from django.shortcuts import redirect,reverse
from functools import wraps

def check_login(func):
    @wraps(func)
    def inner(request, *args, **kwargs):

        if request.session.get("user_type") == 'teacher' :

            return func(request, *args, **kwargs)
        else:
            return redirect(reverse('index'))

    return inner